package org.scs.carleton.ca.pgdt.core.internal.parser;

import org.scs.carleton.ca.pgdt.core.parser.nodes.IASTExpression;
import org.scs.carleton.ca.pgdt.core.visitor.PrologVisitor;

public class ASTExpression extends ASTNode implements IASTExpression {
	private ASTNode lhs, rhs;
	private String operator;
	
	public ASTExpression(ASTTranslationUnit translationUnit, int type, ASTNode lhs, String operator, ASTNode rhs) {
		super(translationUnit, type);
		this.lhs = lhs;
		this.rhs = rhs;
		this.operator = operator;
	}

	@Override
	public boolean accept(PrologVisitor visitor) {
		if (visitor.visit(this)) {
			lhs.accept(visitor);
			rhs.accept(visitor);
		}
		return false;
	}
	
	public ASTNode getLhs() {
		return lhs;
	}

	public ASTNode getRhs() {
		return rhs;
	}

	public String getOperator() {
		return operator;
	}
}
